dateToString: PROCEDURE (d: Date; format: INTEGER; VAR str: ARRAY OF CHAR);
timeToString: PROCEDURE (t: Time; VAR str: ARRAY OF CHAR);
PROCEDURE ValidDate (d: Date): BOOLEAN;
PROCEDURE ValidTime (t: Time): BOOLEAN;
PROCEDURE GetDate (VAR d: Date);
PROCEDURE GetTime (VAR t: Time);
PROCEDURE GetEasterDate (year: INTEGER; VAR d: Date);
PROCEDURE DayOfWeek (d: Date): INTEGER;
PROCEDURE Day (d: Date): LONGINT;
PROCEDURE DayToDate (n: LONGINT; VAR d: Date);
PROCEDURE DateToString (d: Date; format: INTEGER; VAR str: ARRAY OF CHAR);
PROCEDURE TimeToString (t: Time; VAR str: ARRAY OF CHAR);
END Dates.
Module Dates provides basic procedures to work with dates. It covers the Julian calendar up to 10/4/1582 and the Gregorian calendar starting at 10/15/1582. Module Dates can deal with dates from 1/1/1 up to 12/31/9999. The types Date and Time are known to the framework and can be displayed by suitable controls.
Possible value for parameter format of DateToString to specify the format.
TYPE Date
Date information.
year: INTEGER 0001 <= year <= 9999
month: INTEGER 1 <= month <= 12
day: INTEGER 1 <= day <= 31
TYPE Time
Time information.
hour: INTEGER 0 <= hour <= 23
minute: INTEGER 0 <= minute <= 59
second: INTEGER 0 <= second <= 59
PROCEDURE ValidDate (d: Date): BOOLEAN
Test whether d is a valid date according to the Julian (before 1582) or Gregorian (after 1582) calendar. Dates between 10/5/1582 and 10/14/1582 did not exist and are not valid.
PROCEDURE ValidTime (t: Time): BOOLEAN
Test whether time t is valid.
PROCEUDRE GetDate (VAR d: Date)
Get the current date.
PROCEDURE GetTime (VAR t: Time)
Get the current time.
PROCEDURE GetEasterDate (year: INTEGER; VAR d: Date)
Get the Easter date of year.
(year > 1582) & (year < 2300) 20
PROCEDURE DayOfWeek (VAR d: Date): INTEGER
Return the weekday of date d.
ValidDate(d) (not explicitly checked)
result IN {monday .. sunday}
PROCEDURE Day (d: Date): LONGINT;
For date d, return the number of days since 1/1/1. Day(1/1/1) = 1.
The difference between two dates in days can be computed with Day(d2) - Day(d1).
ValidDate(d) (not explicitly checked)
result > 0 & result < 3652062
PROCEDURE DayToDate (n: LONGINT; VAR d: Date);
Convert the number of days since 1/1/1 into a date.
DayToDate(Day(d1), d2) => d1=d2
n > 0 & n < 3652062 (not explicitly checked)
ValidDate(d) & Day(d) = n
PROCEDURE DateToString (d: Date; format: INTEGER; VAR s: ARRAY OF CHAR);
Convert the date d into string s. The format of the conversion is specified through the operation system.
Usually, with format=short only numbers are used (e.g. 01/20/95), whereas with format=long the weekday and the month are spelled out (e.g. Thursday, January 2, 1992), and with format=abbreviated the weekday and the month is abbreviated (e.g. Thu, Jan 2, 1992).
PROCEDURE TimeToString (t: Time; VAR s: ARRAY OF CHAR);
Convert the time t into string s. The format of the conversion is specified through the operating system.